/*
 * @Author: zhi1hw hanwei@zhi1tech.com
 * @Date: 2024-06-16 12:11:03
 * @LastEditors: zhi1hw hanwei@zhi1tech.com
 * @LastEditTime: 2024-07-11 13:08:31
 * @FilePath: \code\src\router\index.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import {
  createRouter,
  createWebHistory,
  createWebHashHistory 
} from "vue-router";
import HomeModule from "./modules/home";

// 路由列表
const routes = [
  {
    path: "/",
    redirect: "/transfer",
    children: [{
      path: "/transfer",
      name: "transfer",
      component: () => import("views/transfer.vue"),
    }],
  },
  {
    path: "/home",
    component: () => import("views/home/index.vue"),
    children: [
      {
        path: "/home/square",
        component: () => import("views/home/components/square.vue"),
      }
    ],
  },

  {
    path: "/preview",
    component: () => import("views/preview.vue"),
    children: [],
  },
  {
    path: "/squareend",
    component: () => import("views/squareend.vue"),
    children: [],
  },
  {
    path: "/polling",
    component: () => import("views/polling.vue"),
    children: [],
  },
  {
    path: "/demo",
    component: () => import("views/demo.vue"),
    children: [],
  },
  {
    path: "/:catchAll(.*)",
    name: "Error",
    meta: {
      title: "404",
    },
    component: () =>
      import(/* webpackChunkName: "base" */ "views/common/errorCatch.vue"),
  },
];

// 导出路由
const router = createRouter({
  history: createWebHashHistory(),
  routes,
  scrollBehavior(to: any, from: any, savedPosition: any) {
    return savedPosition ? savedPosition : { el: "#app", top: 0 };
  },
});

export default router;
